<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
  <script>
    // 块级作用域与函数声明
    function f() {
      console.log('I am outside!')
    }

    ;(function () {
      if (false) {
        // 重复声明一次函数f
        function f() {
          console.log('I am inside!')
        }
      }
      // console.log('fff===', f)

      // f()
    })()

    function foo() {
      debugger
      let myName = '哈哈哈1'
      let test1 = 'test1'
      let test2 = 'test2'
      var innnerBar = {
        setName(name) {
          debugger
          myName = name
        },
        getName() {
          debugger
          console.log('test1==', test1)
          return myName
        },
      }
      innnerBar.setName('哈哈哈2')
      console.log(innnerBar.getName())
      // return innnerBar
    }
    let _bar = foo()
    // _bar.setName('哈哈哈2')
    // console.log(_bar.getName())
  </script>
</html>
